package test.org.nanotek.jpa.name.namepart;

import javax.validation.constraints.NotNull;

import org.nanotek.Builder;
import org.nanotek.base.person.name.NamePart;
import org.nanotek.base.person.name.NamePersonType;

public class NamePartBuilder implements Builder<NamePart>{

	private NamePart name; 
	
	public NamePartBuilder()
	{ 
		name = new NamePart();
	}
	
	public NamePartBuilder setName(@NotNull String value , @NotNull NamePersonType nameType) {
		if (nameType == null)
			name.setNamePersonType(NamePersonType.GivenName);
		else 
			name.setNamePersonType(nameType);
		name.setValue(value);
		return this;
	}
	
	@Override
	public NamePart build() {
		return name;
	}

}
